package redbook;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

/**
 * @author blh
 * @date 2024年06月28日 10:58
 */

public class Main2 {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();

        for (int i = 0; i < T; i++) {

            // 收藏夹的数量
            int n = in.nextInt();
            // 不同MCN的数量
            int x = in.nextInt();
            List<List<String>> list = new ArrayList<>();

            for (int i1 = 0; i1 < n; i1++) {
                int m = in.nextInt();
                // 机构编号
                List<String> temp = new ArrayList<>();

                for (int i2 = 0; i2 < m; i2++) {
                    temp.add(in.next());
                }
                list.add(temp);
            }

            boolean sign = false;
            // 两层循环判断并集
            for (int i1 = 0; i1 < n && !sign; i1++) {
                List<String> list1 = list.get(i1);
                if (list1.size() > x) {
                    continue;
                }
                for (int i2 = i1 + 1; i2 < n; i2++) {
                    List<String> list2 = list.get(i2);
                    if (list2.size() > x) {
                        continue;
                    }
                    list1.addAll(list2);
                    HashSet<String> temp = new HashSet<>(list1);
                    if (temp.size() == x) {
                        System.out.println("YES");
                        System.out.print((i1 + 1));
                        System.out.print(" ");
                        System.out.print((i2 + 1));
                        sign = true;
                        break;
                    }
                }
            }
            if (!sign) {
                System.out.println("NO");
            }
        }

    }
}
